package com.ruijie.autotest.log.impl.data;

import com.ruijie.autotest.log.core.data.IRow;

import java.util.Arrays;

public class ColumnDrivenRow implements IRow {

	private final Columns columns;

	private final String[] values;

	public ColumnDrivenRow(Columns columns, String[] values) {
		this.columns = columns;
		this.values = values;
	}

	@Override
	public String stringValueOf(String columnName) {
		return values[columns.indexOf(columnName)];
	}

	@Override
	public String[] columns() {
		return columns.toArray();
	}

	@Override
	public String toString() {
		return "Row{" +
				"values=" + Arrays.toString(values) +
				'}';
	}
}
